package com.tanqidi.arcgisandroid.ui

import android.Manifest
import android.content.pm.PackageManager
import android.os.Bundle
import android.os.Environment
import android.widget.Toast
import androidx.activity.viewModels
import androidx.appcompat.app.AppCompatActivity
import androidx.core.app.ActivityCompat
import androidx.core.content.ContextCompat
import com.jaredrummler.android.colorpicker.ColorPickerDialogListener
import com.tanqidi.arcgisandroid.R
import com.tanqidi.arcgisandroid.databinding.ActivityMainBinding
import dagger.hilt.android.AndroidEntryPoint
import java.io.File

@AndroidEntryPoint
class MainActivity : AppCompatActivity() , ColorPickerDialogListener {

    companion object{
        const val DIALOG_COLOR_ID = 0
    }

    private lateinit var binding: ActivityMainBinding
    private val mainViewModel by viewModels<MainViewModel>()

    override fun onCreate(savedInstanceState: Bundle?) {
        super.onCreate(savedInstanceState)
        binding = ActivityMainBinding.inflate(layoutInflater)
        setContentView(binding.root)
    }

    override fun onColorSelected(dialogId: Int, color: Int) {
        when (dialogId) {
            DIALOG_COLOR_ID -> {
                mainViewModel.colorLiveData.postValue(color)
            }
        }
    }

    override fun onDialogDismissed(dialogId: Int) {
    }

}